<?php

declare(strict_types=1);

namespace App\CustHub\Request;

use Mine\MineFormRequest;

/**
 * 登录验证
 */
class LoginRequest extends MineFormRequest
{

    public function autoLogin(): array
    {
        return [
            'id' => 'required'
        ];
    }

    public function passwordLoginRules(): array
    {
        return [
            'account' => 'required',
            'password' => 'required'
        ];
    }

    public function mobileLoginRules(): array
    {
        return [
            'mobile' => 'required|mobile',
            'code' => 'required|min:6|max:6'
        ];
    }

    public function registerRules()
    {
        return [
            'mobile' => 'required|mobile',
            'code' => 'required',
            'password' => 'required|confirmed|min:6|max:20',
            'password_confirmation' => 'required|min:6|max:20',
        ];
    }

    public function checkInviteCodeNeedRules(): array
    {
        return [
            'mobile' => 'required'
        ];
    }

    public function messages(): array
    {
        return [
            'mobile.required' => '请输入手机号',
            'mobile.mobile' => '请输入正确的手机号',
            'code.required' => '请输入验证码',
            'password.required' => '请输入密码',
            'password.confirmed' => '密码与再次输入密码需要一致',
            'password.min' => '密码最短不少于6个字符',
            'password.max' => '密码最长不多于二十个字符',
            'password_confirmation.required' => '密码必须再次输入',
            'password_confirmation.min' => '再次输入密码最短不少于6个字符',
            'password_confirmation.max' => '再次输入密码最长不多于二十个字符',
        ];
    }
}